用Cmake 编译OpenCV常见的错误 | 您所在的位置:网站首页 › no object modules specified › 用Cmake 编译OpenCV常见的错误 |
minGW32-make遇到的错误1:
[ 37%] Linking CXX shared library …\bin\libopencv_core341.dll CMakeFiles\opencv_core.dir/objects.a: member CMakeFiles\opencv_core.dir/objects. a(vs_version.rc.obj) in archive is not an object collect2.exe: error: ld returned 1 exit status modules\core\CMakeFiles\opencv_core.dir\build.make:2329: recipe for target ‘bin/ libopencv_core341.dll’ failed mingw32-make[2]: *** [bin/libopencv_core341.dll] Error 1 CMakeFiles\Makefile2:1675: recipe for target ‘modules/core/CMakeFiles/opencv_cor e.dir/all’ failed mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 Makefile:161: recipe for target ‘all’ failed mingw32-make: *** [all] Error 2 解决方法在cmake gui中添加条目OPENCV_VS_VERSIONINFO_SKIP = 1,再重新Configure,Generate。 1. windres.exe: unknown option -- W ... ;或者connot find -lruntmchk 2、'sprintf_instead_use_StringCbPrintfA_ was not declared in this scope .. 解决方案:1、在cmake中 取消勾选 ENABLE_PRECOMPILED_HEADERS,重新编译; 2、在..\opencv\sources\modules\videoio\src\cap_dshow.cpp 在#include "DShow.h"这一行前加上#define NO_DSHOW_STRSAFE 再次重新编译生成新的makefile,成功 常见错误三:: 缺少头文件include 错误五Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj In file included from C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/random:38:0, from C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/bits/stl_algo.h:66, from C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/algorithm:62, from C:/Users/maxingxin/Downloads/opencv/sources/modules/core/include/opencv2/core/base.hpp:55, from C:/Users/maxingxin/Downloads/opencv/sources/modules/core/include/opencv2/core.hpp:54, from C:/Users/maxingxin/Downloads/opencv/build-sources-Desktop_Qt_5_10_1_MinGW_32bit-Default/modules/python_bindings_generator/pyopencv_generated_include.h:1, from C:\Users\maxingxin\Downloads\opencv\sources\modules\python\src2\cv2.cpp:22: C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/cmath:1119:11: error: '::hypot' has not been declared using ::hypot; ^ modules\python3\CMakeFiles\opencv_python3.dir\build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj' failed mingw32-make.exe[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj] Error 1 CMakeFiles\Makefile2:7854: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed Makefile:161: recipe for target 'all' failed 这个的解决办法是: 把下面配置中的BUILD_opencv_python3和下面那个有python的off掉,然后点下面Apply configuration,然后重新build。终于成功了。 祝君顺利!!!!!!!!!! |
CopyRight 2018-2019 实验室设备网 版权所有 |